package cn.com.shopec.erp.purchase.service;

import cn.com.shopec.erp.common.page.PageFinder;
import cn.com.shopec.erp.common.page.PageQuery;
import cn.com.shopec.erp.purchase.entity.StockPurchase;

/**
 * @ClassName: IStockPurchaseService
 * @Description: 采购单关联货品仓库service接口
 * @author: liang shun wang
 * @date 2013-5-22 上午11:05:50
 * 
 */
public interface IStockPurchaseService {

	/**
	 * addPurchaseStock
	 * 
	 * @Description: 添加入库信息
	 * @param StockInProductVo
	 * @return ModelMap
	 * @author: liang shun wang
	 * @throws Exception
	 * @date: 2013-5-21 下午18:22:03
	 */
	public boolean addPurchaseStock(StockPurchase stockPurchase) throws Exception;

	/**
	 * @Description: 从创建时间最久的开始扣
	 * @param StockInProductVo
	 * @return 1.库存id 2.数量
	 * @author: liang shun wang
	 * @throws Exception
	 * @date: 2013-5-21 下午18:22:03
	 */
	public boolean updatePurchaseStockLastNumber(String id, int number) throws Exception;

	/**
	 * @Description: 指定相应id扣除相应的剩余数量
	 * @param StockInProductVo
	 * @return 1.库存id 2.采购单号 3.数量
	 * @author: Liang shun Wang
	 * @throws Exception
	 * @date: 2013-5-21 下午18:22:03
	 */
	public boolean updatePurchaseStockLastNumber(String id, String poNo, int number) throws Exception;

	/**
	 * 根据id得到StockPurchase
	 * 
	 * @param id
	 * @return
	 */
	public StockPurchase getProductPurchaseStock(String id);

	/**
	 * 根据指定条件得到StockPurchase
	 * 
	 * @param stockPurchase
	 * @return
	 */
	public StockPurchase getProductPoNo(StockPurchase stockPurchase);

	/**
	 * 根据采购单号和库存编号查询数量
	 * 
	 * @param id
	 * @param poNo
	 * @return
	 */
	public StockPurchase getProductPoNoStockNo(String stockNo, String poNo);

	/**
	 * 修改
	 * 
	 * @param stockPurchase
	 * @throws Exception
	 */
	public void updateStockPurchase(StockPurchase stockPurchase) throws Exception;

	/**
	 * 分页查询(次品管理中良品转换次品用)
	 * 
	 * @param stockPurchase
	 * @param pageQuery
	 * @return
	 */
	PageFinder<StockPurchase> queryStockPurchaseForDefective(StockPurchase stockPurchase, PageQuery pageQuery);

	/**
	 * 分页查询(包裹出库出良品用)
	 *
	 * @param stockPurchase
	 * @param pageQuery
	 * @return
	 */
	PageFinder<StockPurchase> queryStockPurchaseForQualified(StockPurchase stockPurchase, PageQuery pageQuery);

	/**
	 * 改变采购单库存数量
	 * @param stockPurchase
	 * @return
	 */
	public boolean changeQuantity(StockPurchase stockPurchase);
}
